/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cageballcommon.messages;

import cageballcommon.messages.PlayerAction;
import java.util.Properties;

/**
 *
 * @author kanonas
 */
public class Player implements Position {

    private int id;
    private float x;
    private float y;
    private transient PlayerAction action = new PlayerAction();

    public Player() {
    }

    public Player(int id, float x, float y) {
        this.id = id;
        this.x = x;
        this.y = y;
    }

    public Player(Player player) {
        this(player.getId(), player.getX(), player.getY());
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public float getX() {
        return x;
    }

    public void setX(float xPos) {
        this.x = xPos;
    }

    public float getY() {
        return y;
    }

    public void setY(float yPos) {
        this.y = yPos;
    }

    public PlayerAction getAction() {
        action.setId(id);
        return action;
    }

    public void move(float x, float y) {
        action.setMoveX(x);
        action.setMoveY(y);
    }

    public void move(Position pos) {
       move(pos.getX(), pos.getY());
    }

    public void kick(float x, float y, float strength) {
        action.setKickX(x);
        action.setKickY(y);
        action.setKickStrength(strength);
    }

    public void kick(Position pos, float strength){
        kick(pos.getX(), pos.getY(), strength);
    }

    public void say(String message) {
        action.setSay(message);
    }

    public void resetAction() {
        action = new PlayerAction();
    }

    @Override
    public String toString() {
        return "id=" + id + " x=" + x + " y=" + y;
    }
}
